package com.rimi.project.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.rimi.project.bean.Book;
import com.rimi.project.dao.BookDao;
import com.rimi.project.dao.impl.BookDaoImpl;

@WebServlet("/book/deletebook")
public class BookDeleteServlet extends HttpServlet{
	private BookDao bookDao = new BookDaoImpl();
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		int id = Integer.parseInt(req.getParameter("id"));
		 
		System.out.println(id);
		
		boolean isDelete = bookDao.deleteBookById(id);
		
		// 将删除的结果返回页面
		resp.getWriter().print(isDelete);
	}
}
